<template>
	<view class="set-box">
		<!-- 提现相关 -->
		<view class="s-m">
			<view class="m-t">提现相关</view>
			<!-- <view class="l-i" @click="hardTap(1)">
				<image class="left-i" src="./static/yinhangka.png" />
				<text class="text">银行卡设置</text>
				<uni-icons type="right"></uni-icons>
			</view> -->
			<view class="l-i" @click="hardTap(3)">
				<image class="left-i" src="./static/password.png" />
				<text class="text">支付密码设置</text>
				<uni-icons type="right"></uni-icons>
			</view>
			<!-- @click="hardTap(3)" -->
			<view class="l-i" >
				<image class="left-i" src="https://img.jinghushi.com/images/9/2025/10/XZ9862w8ZV081p95PwVfZf2JP83w5p.png" />
				<text class="text">版本号</text>
				<!-- <uni-icons type="right"></uni-icons> -->
				<text>{{version}}</text>
			</view>
			<view class="l-i" @click="hardTap(2)">
				<image class="left-i" src="@/pages/set/static/tuideng.png"></image>
				<text class="text">退出登录</text>
				<uni-icons type="right"></uni-icons>
			</view>
		</view>
		<view class="s-logo">
			<image class="s-logo-i" src="https://img.jinghushi.com/images/0/2025/10/UCKLlBPq9cVI22B9kiLP2LiB2ILKc9.png" mode="widthFix"></image>
		</view>
		<view class="yin-si">
			<text>阅读</text>
			<text class="color" @click="hardTap(4)">“用户注册协议”</text>
			<text>与</text>
			<text class="color" @click="hardTap(5)">“隐私政策”</text>
		</view>
		<p-pop ref="pPop" @config="hardConfig" />
	</view>
</template>

<script>
	import {
		debounce
	} from 'lodash'
	export default {
		data() {
			return {
				type: '',
				version:''
			}
		},
		onLoad() {
			// #ifdef MP-WEIXIN
			this.getVersion()
			// #endif
		},
		methods: {
			getVersion(){
				const accountInfo = uni.getAccountInfoSync();
				this.$store.commit('upversion', accountInfo.miniProgram.version);
				uni.setStorageSync('ver', accountInfo.miniProgram.version);
				this.version=accountInfo.miniProgram.version
			},
			// 提交事件
			hardTap: debounce(function(type) {
				this.type = type
				// type 类型 1银行卡设置 2退出登录 3用户协议 4隐私政策
				switch (type) {
					case 1:
						this.$navTo('./yinka')
						break;
					case 3:
						this.$navTo('/pages/public/paypassword')
						break;
					case 4:
						this.$navTo('https://bpapi.jinghushi.com/dmq_agreement.html')
						break;
					case 5:
						this.$navTo('https://bpapi.jinghushi.com/dmq_policy.html')
						break;
					case 2:
						this.$refs.pPop.open({
							title: '退出登录',
							content: '点击“退出登录”按钮后，系统将退出当前账号登录状态。下次使用时，需要重新进行登录才可继续使用。',
							config: '退出登录'
						})
						break;
					default:
						break;
				}
			}, 200),
			// 弹窗事件
			hardConfig(e) {
				if (!e) return
				if (this.type == 2) {
					this.outLogin()
				}
			},
			// 退出登录
			async outLogin() {
				uni.clearStorageSync();
				uni.reLaunch({
					url:'/pages/public/login'
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.set-box {
		min-height: 100vh;
		background-color: #fdf8ff;
		font-family: Source Han Sans;
		font-variation-settings: "opsz" auto;
		font-feature-settings: "kern" on;

		.s-m {
			.m-t {
				padding: 20rpx 60rpx;
				color: #5B5B5B;
				font-size: 28rpx;
			}

			.l-i {
				padding: 20rpx 40rpx;
				margin-bottom: 40rpx;
				display: flex;
				align-items: center;
				height: 120rpx;
				background: #FFFFFF;

				.left-i {
					height: 40rpx;
					width: 40rpx;
				}

				.text {
					flex: 1;
					padding: 0 20rpx;
				}
			}
		}

		.s-logo {
			text-align: center;
			padding-top: 40rpx;

			.s-logo-i {
				width: 140rpx;
				// height: 62rpx;
			}
		}

		.yin-si {
			padding: 20rpx;
			text-align: center;

			text {
				color: #5B5B5B;
				font-size: 20rpx;
			}

			.color {
				color: #9A1FE8;
			}
		}
	}
</style>